'\" te
.\" Copyright (c) 2008, Sun Microsystems, Inc.  All Rights Reserved
.\" Copyright 1989 AT&T
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH PUTSPENT 3C "Jan 23, 2008"
.SH NAME
putspent \- write shadow password file entry
.SH SYNOPSIS
.LP
.nf
#include <shadow.h>

\fBint\fR \fBputspent\fR(\fBconst struct spwd *\fR\fIp\fR, \fBFILE *\fR\fIfp\fR);
.fi

.SH DESCRIPTION
.sp
.LP
The  \fBputspent()\fR function is the inverse of \fBgetspent()\fR. See
\fBgetspnam\fR(3C). Given a pointer to a \fBspwd\fR structure created by
\fBgetspent()\fR or \fBgetspnam()\fR, \fBputspent()\fR writes a line on the
stream \fIfp\fR that matches the format of \fB/etc/shadow\fR.
.sp
.LP
The \fBspwd\fR structure contains the following members:
.sp
.in +2
.nf
\fBchar           *sp_namp;
char           *sp_pwdp;
int            sp_lstchg;
int            sp_min;
int            sp_max;
int            sp_warn;
int            sp_inact;
int            sp_expire;
unsigned int   sp_flag;\fR
.fi
.in -2

.sp
.LP
If the \fBsp_min\fR, \fBsp_max\fR, \fBsp_lstchg\fR, \fBsp_warn\fR,
\fBsp_inact\fR, or \fBsp_expire\fR member of the  \fBspwd\fR structure is
\(mi1, or if \fBsp_flag\fR is 0, the corresponding  \fB/etc/shadow\fR field is
cleared.
.SH RETURN VALUES
.sp
.LP
The  \fBputspent()\fR function returns a non-zero value if an error was
detected during its operation. Otherwise, it returns \fB0\fR.
.SH USAGE
.sp
.LP
Since this function is for internal use only, compatibility is not guaranteed.
For this reason, its use is discouraged. If used at all, if should be used with
\fBputpwent\fR(3C) to update the password file.
.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(7) for descriptions of the following attributes:
.sp

.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
_
MT-Level	Unsafe
.TE

.SH SEE ALSO
.sp
.LP
.BR getpwnam (3C),
.BR getspnam (3C),
.BR putpwent (3C),
.BR attributes (7)
